<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * Created by PhpStorm.
 * User: lihao
 * Date: 2017/7/20
 * Time: 下午12:08
 */

class MY_Controller extends CI_Controller {

    public function __construct() {
        parent::__construct();
    }

    public function echoJson($data, $msg, $success) {
        echo json_encode(array(
            'content'=> array(
                'data'=>$data,
                'msg'=>$msg
            ),
            'success'=>$success
        ));
    }

    public function mycreatedir($path) {
        //处理跨域
//        $dir = $_POST['dir'];
//        $path = 'photos/'.$dir;
        $msg = "创建成功";
        $succ = 1;
        if (is_dir($path)) {
            $msg = "文件夹已存在";
            $succ = 0;
            return true;
        } else {
            $res = mkdir($path, 0777, true);
            if ($res) {
                return true;
            } else {
               return false;
            }
        }
    }
}